#include "include.h"
#include "func.h"
#include "func_device.h"
s32 magic_data[5]={-20000,-10000,15000,5000,0};
u8 magic_index=4;
AT(.text.func.device)
void func_device_switch_magic_mode(void)
{
	magic_index++;
	printf("magic_index:%d\n",magic_index);
	if(magic_index>4)
	{
		magic_index=0;
	}
	magic_audio_param_set(magic_data[magic_index]);
}
AT(.text.func.device)
void func_device_set_mic_vol(u8 dir)
{
	wireless_tx_user_vol_cmd(VOL_OUT,dir);
}

AT(.text.func.device)
void func_device_message(u16 msg)
{
	if(msg!=0&&msg!=0x7FF)
	{
		printf("key msg:0x%x\n",msg);
	}
    switch (msg) {
	#if 1
	case KU_VOL_UP:
		func_device_set_mic_vol(1);
		break;
	case KU_VOL_DOWN:
		func_device_set_mic_vol(0);
		break;
	case KU_MODE:
		func_device_switch_magic_mode();
		break;
	case KL_POWER:
		func_cb.sta = FUNC_PWROFF;
		break;
	#else
    case KU_PLAY:
    case KU_PLAY_USER_DEF:
    case KU_PLAY_PWR_USER_DEF:
//        my_printf("pp\n");
        wireless_music_play_pause();
        break;

    case KL_PLAY_PWR_USER_DEF:
    case KL_PLAY_USER_DEF:
        break;

    case KU_PREV_VOL_DOWN:
    case KU_PREV_VOL_UP:
    case KL_VOL_DOWN_PREV:
    case KL_VOL_UP_PREV:
    case KU_PREV:
        wireless_music_prev();
        break;

    case KU_NEXT:
    case KU_NEXT_VOL_UP:
    case KU_NEXT_VOL_DOWN:
    case KL_VOL_UP_NEXT:
    case KL_VOL_DOWN_NEXT:
        wireless_music_next();
        break;
	#endif
    case MSG_SYS_1S:
        break;

    default:
        func_message(msg);
        break;
    }
}
